package com.htthorizon.neo4j.repository;

import com.htthorizon.neo4j.entity.Model;
import com.htthorizon.neo4j.entity.RelationShip;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RelationShipRepository extends Neo4jRepository<RelationShip, Long> {
    @Query("MATCH p=()-[:R1{name:$name}]->()  RETURN p")
    List<RelationShip> findByBdName(@Param("name") String name);

    @Query("MATCH (n)-[h:R1]->(m) RETURN n , h , m")
    List<RelationShip> All();
    @Query("MATCH p=(a:Root)-[r:R1]->(b:BD) Where id(b)= $id  RETURN a,r,b")
    List<RelationShip> findByBdId(@Param("id")Long id);
}
